
var app=getApp();
var util = require('../../../utils/util')
Page({

  /**
   * 页面的初始数据
   */
  data: {
    coupons:[]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    
  },
  // 获取优惠券列表
  getCoupons(){
    var that = this;
    wx.request({
      url: app.globalData.urls + '/order-manage/coupon-list',
      method: 'POST',
      data: {
        bdmin_user_id:util.getBdmin_user_id()
      },
      header: app.getPostRequestHeader(),
      success: function (res) {
        console.log(res)
        if (res.data.code == '200') {
          var  data = res.data.data;
          that.setData({
            coupons:data
          })
          console.log("优惠券类表",data)
        }
      }
    })
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    this.getCoupons();
  },
  // 新增优惠券
  consendConfrim(){
    wx.navigateTo({
      url: '/pages/business/add-coupon/add-coupon',
    })
  },
  // 编辑
  edit(e){
    wx.navigateTo({
      url: '/pages/business/add-coupon/add-coupon?item='+JSON.stringify(e.currentTarget.dataset.item),
    })
  }
})